package com.hustzp.com.xichuangzhu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.hustzp.com.xichuangzhu.utils.CommonUtils;

/**
 * Created by fujiangren on 16/5/26.
 */
public class SplashActivity extends Activity{

    private Handler splashHandler = new Handler();

    private Runnable splashRunnable = new Runnable() {
        @Override
        public void run() {

            startActivity(new Intent(SplashActivity.this,MainActivity.class));
            SplashActivity.this.finish();

        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        initStatusbar();

        splashHandler.postDelayed(splashRunnable, 500);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        splashHandler.removeCallbacks(splashRunnable);
    }



    private void initStatusbar() {

        if (CommonUtils.isMIUI()) {
            CommonUtils.setMiuiStatusBarDarkMode(this, true);
        } else if (CommonUtils.isFlyme()) {
            CommonUtils.setFlymeStatusBarDarkIcon(this, true);
        }
    }
}
